<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('角色选择')" />
    <style type="text/css">
    .layui-col-md2{max-width:220px}
    .layui-form-item {margin-bottom: 0px;}
    .layui-form-label {width: 92px;margin-left: -10px;margin-right: -10px;}
    .layui-input-block{margin-left:100px;}
    .layui-input{max-width: 138px;}
    </style>
</head>
<body>
<form>
     <div class="layui-form-item">
     	<div class="layui-inline">
          <label class="layui-form-label">部门名称：</label>
          <div class="layui-input-block">
              <input type="text" name="orgName" id="orgName" autocomplete="off" placeholder="请输入部门名称" class="layui-input">
          </div>
      </div>
         <div class="layui-inline" style="margin-right: 40px;float: right;">
             <a class="layui-btn layuiadmin-btn-order dhicon dh-search" id="btn-search"><span class="fa_span">查询</span></a>
             <button type="reset" class="layui-btn layui-btn-primary dhicon dh-refresh" id="dh-resets"><span class="fa_span">重置</span></button>
         </div>
     </div>
</form>
<div style="padding: 0 10px;">
	<div class="layui-inline layui-col-md12">
		<table class="layui-hide" id="dhtable" lay-filter="ftable"></table>
	</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
	/*<![CDATA[*/
	var prefix = ctx + "system/organization/";
	/*]]>*/
</script>
<script type="text/javascript">
var $,layer,table,form,laydate,wherestr={};
layui.use(['table','layer','jquery','form','laydate'], function () {
	$ = layui.$,layer = layui.layer,table = layui.table,form = layui.form,laydate=layui.laydate;
    $.tablelist.init({
        elem: '#dhtable'
        ,url: prefix+"/listbydepe?orgKind=dept"
        ,initSort: {field: 'orgName',type: 'asc'}
		,where: {
	    	field: 'orgName' //排序字段
	    	,order: 'asc' //排序方式
	    }
		,sort:true
		,cols: [[
			{type:'radio'},
			{type:'numbers'},
		    {field: 'orgName',title: '部门名称',width:140},
		]
		]
        ,height:'full-50'
    });
	table.on('row(ftable)', function(obj){
   		obj.tr.find('input[lay-type="layTableRadio"]').prop("checked",true);
		var index = obj.tr.data('index')
       	var thisData = table.cache.dhtable;	//dhtable 表名
       	//重置数据单选属性
       	layui.each(thisData, function(i, item){
      		if(index === i){
               item.LAY_CHECKED = true;
       	} else {
           	delete item.LAY_CHECKED;
       	}
       	});
       	form.render('radio');
   	});
 	//搜索按钮
 	$('#btn-search').on('click', function () {
        table.reload('dhtable', {page: {curr: 1},where:{orgName:$("#orgName").val()}});
     });
});
var callbackdata = function () {
	if(!!table.checkStatus('dhtable').data[0]){
	    return table.checkStatus('dhtable').data[0];
	}else{
		return "none";
	}
}
</script>
</body>
</html>